package com.corechina.apex_osswords.domain.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.corechina.apex_osswords.domain.entity.CoreEquipment;
import com.corechina.apex_osswords.domain.vo.CoreEquipmentVo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;

/**
 * <p>
 * 设备表 Mapper 接口
 * </p>
 *
 * @author cc
 * @since 2022-12-09
 */
@Component
public interface CoreEquipmentMapper extends BaseMapper<CoreEquipment> {

    IPage<CoreEquipmentVo> getList(Page page, @Param("name") String name, @Param("place") Integer place, @Param("serviceId") Integer serviceId, @Param("type") Integer type, @Param("projectId") Integer projectId, @Param("enterpriseId") Integer enterpriseId);

    String getMaxSerialNumber(@Param("enterpriseId") Integer enterpriseId, @Param("projectId") Integer projectId);

    int checkSerialNumber(@Param("serialNumber") String serialNumber);

    IPage<CoreEquipmentVo> getEquipmentForWeiXin(Page page, @Param("projectId") Integer projectId, @Param("place") Integer place, @Param("serviceId") Integer serviceId, @Param("type") Integer type, @Param("userId") Integer userId);

    CoreEquipmentVo getOneForWeiXin(@Param("id") Integer id);

    CoreEquipmentVo getEquipmentDetailsBySerialNumber(@Param("serialNumber") String serialNumber);

    @Select("select id from core_equipment where serial_number = #{serialNumber}")
    Integer getIdBySerialNumber(@Param("serialNumber") String serialNumber);

}
